package com.mmall.concurrency.example.threadPool;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @ClassName ThreadPoolExample1
 * @Description TODO
 * @Author wushaopei
 * @Date 2019/11/3 22:57
 * @Version 1.0
 */
@Slf4j
public class ThreadPoolExample1 {

    public static void main(String[] args) {

        ExecutorService e = Executors.newCachedThreadPool();

        for (int i = 0 ; i < 10 ; i++){
            final int index = i;
            e.execute(new Runnable() {
                @Override
                public void run() {
                    log.info("task:{}" ,index);
                }
            });
        }
        e.shutdown();
    }
}
